# Maintainer: Martell Malone <martellmalone@gmail.com>

_realname=wslay
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.1.0
pkgrel=1
pkgdesc="The WebSocket library in C (mingw-w64)"
arch=('any')
url="https://github.com/tatsuhiro-t/wslay"
license=("custom")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
options=('staticlibs' 'strip')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/tatsuhiro-t/wslay/archive/release-${pkgver}.tar.gz")
sha256sums=('df5dca9f03614073cd8bdd22aa3c9b116f841ed3120b2d4463d2382cc44fc594')

prepare() {
  cd "${srcdir}/${_realname}-release-${pkgver}"
  autoreconf -fi
}

build() {
  [[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-release-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST}
  make -C lib
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" -C lib install
}
